/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cbaApplication;

import java.rmi.RemoteException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Rente
 */
public class EnviaResumoThread extends Thread {

    CBA cba;

    public EnviaResumoThread(CBA cba) {

        this.cba = cba;
    }

    @Override
    public void run() {
        while (true) {
            try {
                Thread.sleep(10000);
                System.out.println("### Enviando resumo pro server");
                cba.getBankServerIf().guardaOperacoes(cba.getListaOperacoes());
                cba.refreshOperacoes();
                cba.getSc().setState(true);
                cba.getFiles().deleteOperations();

            } catch (Exception ex) {
                ex.printStackTrace();
                cba.setConnected(false);
                cba.getSc().setState(false);
            }
        }
    }
}
